#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2024 ArchR (https://github.com/archr-linux/Arch-R)

# this quirk is for the powkiddy rgb20 pro which pk have
# shipped using the rk2023 device tree

if grep -q "024C:D723" "/sys/devices/platform/fe000000.mmc/mmc_host/mmc3/mmc3:0001/mmc3:0001:1/uevent"; then
  if ! grep -q "FDTDIR" /flash/extlinux/extlinux.conf; then
    mount -o rw,remount /flash
    sed -i '/FDT \/rk3566-powkiddy-rk2023.dtb/c\  FDTDIR /' /flash/extlinux/extlinux.conf
    sync
    reboot
  fi
fi
